package com.attendance.attendance;

import com.attendance.mapper.AttendanceMapper;
import com.attendance.vo.EntranceVO;
import com.attendance.service.AttendanceService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;

@SpringBootTest
public class test {
    @Autowired
    AttendanceMapper studentMapper;
    @Test
    public void test1(){
        QueryWrapper<Object> wrapper = new QueryWrapper<>();
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate parse = LocalDate.parse("2022-04-17", dtf);
        wrapper.like("stu.stuNum","199");
        wrapper.apply("date_format (att.attTime,'%Y-%m-%d') >= date_format('" + parse + "','%Y-%m-%d')");
        Page<EntranceVO> page = new Page<>();
//        wrapper1.like("stuNum","199");
//        wrapper2.apply("date_format (attTime,'%Y-%m-%d') >= date_format('" + parse + "','%Y-%m-%d')");
//        wrapper2.eq("att.stuId",17);
//        wrapper2.eq(Attendance::getClockTime,parse);
//        HashMap<String, Wrapper> wrapperMap = new HashMap<>();
//        wrapperMap.put("stu",wrapper1);
//        wrapperMap.put("att",wrapper2);
//        IPage<EntranceVO> repage = studentMapper.findStudentEntranceByWrapper(wrapper, page);

    }
    @Autowired
    AttendanceService attendanceService;
    @Test
    public void test2(){
//        HashMap<String, Object> map = new HashMap<>();
//        attendanceService.findStudentAttendanceByParamMap(map);
    }
}
